﻿using System;
using System.Windows.Forms;
namespace UniMana.Win.Training
{
    public partial class FrmSchedule_SubChooseSubject_SubInfo : DevExpress.XtraEditors.XtraForm
    {
        public FrmSchedule_SubChooseSubject_SubInfo(
             bool status,
             string newName,
             bool check_lt,  bool check_thh,  bool check_bt,  bool check_da,  bool check_th,
             string str_lt,  string str_thh,  string str_bt,  string str_da,  string str_th,
            bool check_Create,
            string str_Note)
        {
            InitializeComponent();
            #region [Gán Dữ Liệu]
            Cache.m_status = status;
            Cache.m_newName = newName;

            Cache.m_check_lt = check_lt;
            Cache.m_check_thh = check_thh;
            Cache.m_check_bt = check_bt;
            Cache.m_check_da = check_da;
            Cache.m_check_th = check_th;

            Cache.m_str_bt = str_bt;
            Cache.m_str_da = str_da;
            Cache.m_str_lt = str_lt;
            Cache.m_str_th = str_th;
            Cache.m_str_thh = str_thh;
            Cache.m_note = str_Note;
            Cache.m_scorede = check_Create;

            #endregion

            #region [Khởi tạo dữ liệu trên công cụ]
            ckeTheory.Checked = Cache.m_check_lt;
            ckePractice.Checked = Cache.m_check_thh;

            txtSubjectName.Text = Cache.m_newName;

            lci_THH.Text = Cache.m_str_thh;
            lci_LT.Text = Cache.m_str_lt;

            ckeCreateSubjectClass.Checked = Cache.m_scorede;
            txtNote.Text = Cache.m_note;

            txtCredits.Text = Cache.m_txtCredits;
            txtLessons.Text = Cache.m_txtLessons;
            #endregion
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            Cache.m_status = false;
            this.Close();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            DialogResult result = new DialogResult();
            result = MessageBox.Show(
                "Bạn Có Chắc Chọn Môn: " + txtSubjectName.Text,
                "Thông Báo",
                MessageBoxButtons.YesNo);

            if (result == DialogResult.Yes)
            {
                Cache.m_status = true;

                Cache.m_check_lt = ckeTheory.Checked;
                Cache.m_check_thh = ckePractice.Checked;

                Cache.m_newName = txtSubjectName.Text;

                Cache.m_str_thh = lci_THH.Text;
                Cache.m_str_lt = lci_LT.Text;

                Cache.m_note = txtNote.Text;
                Cache.m_scorede = ckeCreateSubjectClass.Checked;

                Cache.m_txtCredits = txtCredits.Text;
                Cache.m_txtLessons = txtLessons.Text;

                this.Close();
            }
            else
            {
            }
        }
    }
}